<template>
    <div class="safe2Reform hideWarning">
        <div class="safe2ReformBox">
            <noData v-if="listArr2 == 0"></noData>
            <ul class="listul" v-if="showView == 0" v-for="(item,index) in listArr2" :key="index">
                <li  v-for="(childItem,childIndex) in item.problemSummaries"
                    v-bind:key="childIndex">
                    <div class="form-item form-item-style1">
                        <div class="label-title">
                            <label @click="show_p(childItem.Description)">{{childItem.Description}}</label>
                        </div>
                        <div class="right-select"
                            @click="selectType(childItem.checkTitleNamesId)">
                            2条  
                        </div> 
                        <i class="iconfont icon-jinru rightmsg"></i>
                    </div>
                </li>
            </ul>
            <div class="standard-wrap"
                 v-if="showView == 1">
                <div v-for="(item,index) in  listArr2"
                    v-bind:key="index"
                    class="item-wrap">
                    <standardItem :item="item" 
                                  :showChild="showChild" 
                                  :selectStandard="selectStandard" 
                                  :show_p="show_p"
                                  @selectType="selectType"></standardItem>
                </div>
            </div>
        </div>
        <!-- <actionsheet
            v-model="show"
            :menus="menu7"
            @on-click-menu="click">
        </actionsheet> -->
        <myMenu></myMenu>
        
    </div>
</template>
<script>
import { Actionsheet} from 'vux'
import standardItem from '../select1'
import myMenu from '@/commonComponents/menu'
export default{
    components: {
        standardItem,
        Actionsheet,
        myMenu
    },
    data () {
        return {
            show: false,
            showView: 0,
            menu7:{name: ''},
            listArr2:[],
            param:{
                allowPaging:true,
                business:'GetCheckWorkHiddenDangers',
                data:{
                    type:'',
                    id:''
                },
                pageIndex:0,
                pageSize:1000,
                tokenId:'D0853C0CE5A6A478F5C613B840394FC3',
                userId:''
            },
        }
    },
    created(){
        var token =JSON.parse(window.localStorage.getItem('userInfo'))
        this.param.userId=token.userid
        this.param.data.type=this.$route.query.type
        this.param.data.id=this.$route.query.id
    },
    mounted(){
        this.dataArr()
    },
    methods : {
        //跳转到隐患详情页面
        selectType(id){
            this.$router.push({
                path: '/',
                query: {
                    id: id
                }
            })
        },
        click (key,item) {
            if(key==1){
                this.$router.push({path:"/testing",query:{"add":"add"}})
                localStorage.newadd = 'add';
            } else {
                this.$router.push({path:"/viewAddPlan",query:{title:item}})
            }
        },
        show_p(item){
            console.log(item,111)
            this.show=true
            this.menu7.name=item
        },
        showChild (deptId, item) {
            item.open = !item.open
        },
        selectStandard (item) {
            item.checked = !item.checked
        },
        dataArr(){
            this.$axiosAjax.getConfigJson(this.param).then((res)=>{
                    if (res.status){
                        var arr =res.data.data
                        var a =[]
                        for(var k of arr){
                            for(var j of k.problemSummaries){
                                a.push(j.No)
                                j.checked = false
                            }
                            k.open=false
                        }
                        this.total=a.length
                        this.listArr2=arr
                    }
                }
            )
        },
    }
}
</script>
<style lang="less">
.safe2Reform{
    width: 100%;
    height: 100%;
    background-color: #ebeef2;
    .header{
        width: 100%;
        height: 40px;
        line-height: 40px;
        text-align: center;
        position: relative;
        font-size: 18px;
        background: #2269ff;
        color: #fff;
        .vux-x-icon{
            fill:cornsilk;
            position: absolute;
            left: 0;
            top: 5px;
            width: 30px;
            height: 30px;
        }
    }
    .safe2ReformBox{
        height: 603px;
        width: 100%;
    }
    .weui-actionsheet{
        top: 30%;
        // width: 90%;
        // left: 20px;
        background-color:rgba(0,0,0,0);
    }
    .weui-actionsheet__menu{
        margin: 0 auto;
        width: 80%;
        height: 200px;
        overflow-y: auto;
        line-height: 20px;
        border-radius: 10px;
    }
    .vux-actionsheet-menu-default{
        padding: 10px!important;
        text-align: left;
    }
    .standard-name span{
        margin-left: 20px;
        font-size: 16px;
    }
    .standard-item{
        border-top: 1px solid #efeff4;
    }
}
.pswp{
    display: none;
}
.listul{
    background-color: #fff;
}
</style>
<style>
.hideWarning .iconfont{
    margin-left: 10px;
}
.hideWarning .right-select{
    font-size: 14px;
}
</style>